{% extends "base.html" %}
{% block title %}<title>刘旭的博客</title>{% endblock %}
{% block style %}<link href="/static/css/comments.css" rel="stylesheet" type="text/css">{% endblock %}
{% block body1 %}{% include "nav.html" %} {% endblock %}
{% block bodyside %}
<div class="sidebar-module sidebar-module-inset">
<a href="/blogwrite">添加文章</a>
</div>
<div class="sidebar-module sidebar-module-inset">
    <h3>置顶文章</h3>
</div>
    <div class="sidebar-module sidebar-module-inset" id="toptitle"></div>
{% endblock %}

{% block bodymain %}
	<h1>{{title}}</h1>
	<br>
	<h2>{{author}}</h2>
	<br>
	<div>{{content|safe}}</div>
<label></label>
<div class="form-groupmain">
    <span class="input input--isao">
		<input placeholder="评论内容" class="input__field input__field--isao" type="text" id=input_comment">
		<label class="input__label input__label--isao" for="input_comment">
            <span class="input__label-content input__label-content--isao"></span>
        </label>
        <a type="button" class="btn btn-primary btn-block ladda-button addcomment" title="" data-style="expand-right" data-original-title="评论">
							<span class="ladda-label">
								提交评论
							</span>
        </a>
    </span>
</div>
<ul class="media-list" id="comment"></ul>
{% endblock %}
{% block script %}
<script src="/static/js/blog.js" type="text/javascript"></script>
<script>
	$.get_comment=function(){
        $.getJSON("/json/blogcomments/{{id}}",function (data){
            show(data);
        });
	};
$(document).ready(function(){
    $.get_comment();
    
    
    $('.addcomment').click(function(){
        var content=$(this).parent().children().first().val();
        if(content!=''){
        var comment={'content':content,'id':{{id}}};
        $.post("/commentpost",comment,function(data,status){
            $.get_comment();
        });
        }
    });

});
$.ajaxSetup({headers: {"X-CSRFToken": '{{ csrf_token }}'}});
</script>{% endblock %}